<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

 <link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="./modern.css">
<link href="./modern-responsive.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>

<title>Techniques AJAX - XDomainRequest</title>

<script type="text/javascript">
<!-- 

function getXDomainRequest() {
        var xdr = null;
        
        if (window.XDomainRequest) {
                xdr = new XDomainRequest(); 
        } else if (window.XMLHttpRequest) {
                xdr = new XMLHttpRequest(); 
        } else {
                alert("Votre navigateur ne gère pas l'AJAX cross-domain !");
        }
        
        return xdr;        
}


function sendData() {
        var xdr = getXDomainRequest();
        xdr.onload = function() {

                alert(xdr.responseText);
        }
        
        xdr.open("GET", "http://www.foxycode.net/dev/ajax/XDomain_1.php");
        xdr.send();
}
 
//-->
</script>
</head>

  <body>
    <header>
      <div id="imglogo"></div>
      <div id="titrelogo">IOBH</div>
    </header>

        <div id="middlebox" style="margin:auto;padding-top: 50px;width: 600px;">
                Cross Domain :
                <br/>
                <br/>
              
                Cliquez pour récupérer une valeur provenant du site : www.foxycode.net
                <br/>
                <br/>
                <input type="button" onclick="sendData();" value="Recuperer" />
        </div>
        <div id="textRecupere" style="margin:auto;padding-top: 50px;width: 600px;height:00px;">

        </div>

        <footer>
                © 2012 Honoré & Giovanetti.
        </footer>       
</body>
</html>